
<!DOCTYPE html>
<html>
<head>
  <title>锐眼无线网络管控平台管理员登录</title>
  <link rel="stylesheet" href="__PUBLIC__/css/style.css">


  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</head>
<body>
<h1>锐眼无线网络管控平台管理员登录</h1>
<div class="main-agileinfo">
  <form method="post" id="mform" name="mform">
  <input type="text" name="username" id="username"  class="name" placeholder="账号" >
  <input type="password" name="pwd" id="pwd"  class="password" placeholder="密码"  >

    <div class="alert alert-danger" style="display: none;
                                        border-color: #c0392b;
                                        color: #c0392b;
                                        border-radius: 0;
                                        background-clip: padding-box;
                                        -webkit-border-image: none;
                                        -o-border-image: none;
                                        border-image: none;
                                        border-style: none none none solid;
                                        border-width: 0 0 0 4px;
                                        background-color: #f2dede;
                                        padding: 15px;
                                        margin-bottom: 20px;
"></div>
  <input type="submit" value="登 录">


  </form>
</div>
<div class="footer-w3l">
  <p class="agile"> &copy; 2017 锐眼无线网络管控平台</a></p>
</div>
</body>

<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/jquery.validate.js"></script>

<script type="text/javascript">
    $(function() {

        $('input[name="username"]').focus();

        $("#mform").validate({
            rules:{
                username:{
                    required:true,
                    maxlength:20,
                    minlength:4
                },
                pwd:{
                    required:true,
                    maxlength:20,
                    minlength:4
                }
            },
            messages: {
                username: {
                    required:'请输入用户名',
                    minlength: jQuery.format("用户名不能小于{0}个字符")
                },
                pwd: {
                    required:'请输入密码',
                    minlength: jQuery.format("密码不能小于{0}个字符")
                }
            },
            errorPlacement: function(error, element) {
                error.appendTo(element.parent());
                $(".alert-danger").show();
                $(".alert-danger").html(error);
            },

            submitHandler: function(form) {  //通过之后回调

                var param = $("#mform").serialize();
                $.ajax({
                    url : "{:U('/Home/Login/login','',false)}",
                    type : "post",
                    dataType : "html",
                    cache:false,
                    data: param,
                    success:function(msg){

                        var result=eval('(' + msg + ')');
                        if(!result.status){
                            $(".alert-danger").show();
                            $(".alert-danger").html(result.info);
                            setTimeout(function(){$(".alert-danger").hide()}, 3000 );

                        }
                        else
                        {
                            window.location.href=result.url;
                        }
                    }
                });
            },
            invalidHandler: function(form, validator) {  //不通过回调
                return false;
            }
        });


    });
</script>
</html>